<%@ page language="java" import="java.util.*,com.beans.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
	Map<Integer,ShopCart>shopCartMap =(Map<Integer,ShopCart>)session.getAttribute("shopCartMap");
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath %>" />
<title>购物车</title>
<link rel="stylesheet" type="text/css" href="css/basestyle.css">
</head>
<body>
<div id="div_content">
	<%
		MemberInfo user=(MemberInfo)session.getAttribute("user");
	%>
<jsp:include page='<%= user==null?"../top.jsp":"../top_login.jsp" %>'></jsp:include>
<table id="maintable" >
  <tr>
    <td>&nbsp;</td>
    <td>
    	<table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="60" class="first_td"><img src="images/Car_icon_04.gif" /></td>
      </tr>
      <tr>
        <td>
		        <table cellspacing="0" cellpadding="0" border="0">
		            <tr valign="middle">
		              <td><img hspace="5" src="images/Car_07.gif" /></td>
		              <td class="carbg_current">查看购物车物品</td>
		              <td><img height="39" src="images/Car_15.gif" width="1" /></td>
		              <td align="center"><img hspace="5" src="images/Car_09.gif" /></td>
					  <td class="carbg_default">填写用户邮递地址</td>
		              <td><img height="39" src="images/Car_15.gif" width="1" /></td>
					  <td align="center"><img hspace="5" src="images/Car_09.gif" /></td>
		              <td class="carbg_default">选择付款方式</td>
		              <td><img height="39" src="images/Car_15.gif" width="1" /></td>
		              <td align="center"><img hspace="5" src="images/Car_11.gif" /></td>
		              <td class="carbg_default">订单提交成功</td>
		              <td><img height="39" src="images/Car_15.gif" width="1" /></td>
		            </tr>
		        </table>
        </td>
      </tr>
      <tr>
        <td align="center">
        <form action="" method="post" name="f1">
			<table cellspacing="1" cellpadding="0" width="94%" border="0" bgcolor="#F7F3F7">
              <tr style="height: 26px">
                <td class="blackTitle" align="center">商品名称</td>
                <td class="blackTitle" align="center">价格</td>
                <td class="blackTitle" align="center">数量</td>
                <td class="blackTitle" align="center">金额</td>
                <td class="blackTitle" align="center">删除</td>
              </tr>
				<c:forEach var="entry" items="${sessionScope.shopCartMap}" >
				  <tr class="text" align="center" bgcolor="#FFFFFF">
					<td>
					    ${entry.value.goodsName}
					   <input type="hidden" name = "goodsId" value=" ${entry.value.goodsId}"/>
					 
					</td>
					<td>
					  ￥${entry.value.goodsPrice}元
					</td>

					<td>
					  <!--<input name="goodsNumber" type="text" value="${entry.value.goodsNumber}" size="4" />
					  --><label>${entry.value.goodsNumber}</label>
					</td>
					
					<td>
					  <span id="money">${entry.value.goodsAmount}</span>
					</td>
					<td>
					 <a onclick="return confirm('确定要把该商品从购物车移除吗?')" href="ShopCartServlet?flag=remove&goodsId=${entry.value.goodsId}"><img border="0"  src="images/delete_01.gif" border="0"/></a>
					</td>
				  </tr>
				</c:forEach>
              <tr>
                <c:if test="${sessionScope.shopCartMap!=null}">
                    <td colspan="6" class="order_total"><img hspace="5" src="images/me03.gif" align="middle" /> 
						<span id="totalMoney">${totalMoney}</span> （不包括配送费用）				
				    </td>
                </c:if>
				 <c:if test="${sessionScope.shopCartMap==null}">
                    <td colspan="6" class="Order_Total">
                       
						<span id="totalMoney">当前购物车里没有任何货物,请您选购!</span> 	
						<br/><br/>
				    </td>
                </c:if>

              </tr>				
							
        </table>
        </form>
        </td>
      </tr>
	  <tr style="height: 20px"><td colspan="5"></td></tr>	  
      <tr align="right">
        <td>
          <c:if test="${sessionScope.shopCartMap!=null}" >
		    <a onclick="return confirm('确定要把该商品从购物车移除吗?')" href="${pageContext.request.contextPath }/ShopCartServlet?flag=removeAll"><img border="0"  style=""  src="${pageContext.request.contextPath }/images/Car_icon_01.gif" style="BORDER: 0px;WIDTH: 126px; HEIGHT: 39px;"/></a>
			<a href="${pageContext.request.contextPath }/index.jsp"><img border="0" style="CURSOR: hand"  src="${pageContext.request.contextPath }/images/Car_icon_02.gif" /></a>
			<a href="${pageContext.request.contextPath }/shopping/addressInfo.jsp"><img src="${pageContext.request.contextPath }/images/Car_icon_03.gif"  border="0" style="CURSOR: hand"/></a>
		  </c:if>
		  <c:if test="${sessionScope.shopCartMap==null}" >
			<a href="${pageContext.request.contextPath }/index.jsp" style="margin-right: 50px">
			<img border="0" style="CURSOR: hand"  src="${pageContext.request.contextPath }/images/Car_icon_02.gif" /></a>
		  </c:if>
		</td>
      </tr>
      <tr align="right">
        <td height="20">&nbsp;</td>
      </tr>
    </table>	</td>
    <td>&nbsp;</td>
  </tr>
</table>
<%@ include file="../bottom.jsp" %>
</div>
</body>
</html>


